
package com.example.demo.mybatis.controller;

import com.example.demo.mybatis.model.PlcKwhPojo;
import com.example.demo.mybatis.service.KwhService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/kwh")
public class KwhController {

    @Autowired
    private KwhService kwhService;

    @GetMapping("/{id}")
    public PlcKwhPojo getKwh(@PathVariable Long id) {
        return kwhService.getKwh(id);
    }

    @GetMapping("/all")
    public List<PlcKwhPojo> getAllPlcKwh() {
        return kwhService.getAllPlcKwh();
    }

    @GetMapping("/find")
    public List<PlcKwhPojo> find(PlcKwhPojo plcKwhPojo) {
        return kwhService.findByCondition(plcKwhPojo);
    }

    @GetMapping("/find2")
    public List<PlcKwhPojo> find2(PlcKwhPojo plcKwhPojo) {
        return kwhService.findByCondition2(plcKwhPojo);
    }
}
